From 25c6c2678e69375356ece4d187ac3a056b56601a Mon Sep 17 00:00:00 2001 From: Zhu Yujie Date: Wed, 19 Nov 2025 17:09:52 +0800 Subject: [PATCH] siflower: 6.12: apply trivial driver fixes Apply trivial fixes for 6.12 files: - Make functions static - Add lots of missing header in drivers - Fix no newline at end of file error and other new line error - Drop deprecated validate function for xgmac - Use devm for stmmac probe - Remove host_ prefix from pcie_host_ops Tested-by: Jingkun Zheng Tested-by: Zhu Yujie Tested-by: Chuanhong Guo gch981213@gmail.com Signed-off-by: Zhu Yujie [ improve commit description ] Link: https://github.com/openwrt/openwrt/pull/20555 Signed-off-by: Christian Marangi --- .../drivers/clk/siflower/clk-sf19a2890.c | 2 +- .../drivers/net/ethernet/siflower/Makefile | 2 +- .../drivers/net/ethernet/siflower/dpns.h | 2 +- .../drivers/net/ethernet/siflower/eth.h | 2 +- .../drivers/net/ethernet/siflower/sf_dpns.c | 13 +++-- .../net/ethernet/siflower/sf_dpns_se.c | 2 +- .../net/ethernet/siflower/sf_dpns_se.h | 2 +- .../net/ethernet/siflower/sfxgmac-dma.c | 7 +-- .../net/ethernet/siflower/sfxgmac-ext.h | 4 +- .../drivers/net/ethernet/siflower/sfxgmac.c | 51 +++++-------------- .../drivers/net/ethernet/siflower/sfxpcs.c | 4 ++ .../ethernet/stmicro/stmmac/dwmac-sf19a2890.c | 10 +--- .../files-6.12/drivers/net/phy/siflower.c | 8 +-- .../drivers/pci/controller/dwc/pcie-sf21.c | 7 ++- .../files-6.12/drivers/phy/siflower/Kconfig | 1 - 15 files changed, 47 insertions(+), 70 deletions(-) diff --git a/target/linux/siflower/files-6.12/drivers/clk/siflower/clk-sf19a2890.c b/target/linux/siflower/files-6.12/drivers/clk/siflower/clk-sf19a2890.c index a8644156aa..30afd3279a 100644 --- a/target/linux/siflower/files-6.12/drivers/clk/siflower/clk-sf19a2890.c +++ b/target/linux/siflower/files-6.12/drivers/clk/siflower/clk-sf19a2890.c @@ -209,7 +209,7 @@ static unsigned long sf19a28_muxdiv_recalc_rate(struct clk_hw *hw, return parent_rate / div; } -int sf19a28_muxdiv_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) +static int sf19a28_muxdiv_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) { unsigned int div; diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/Makefile b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/Makefile index 557edb5abc..8149666b08 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/Makefile +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/Makefile @@ -8,4 +8,4 @@ obj-$(CONFIG_NET_SIFLOWER_ETH_DPNS) += sf_dpns.o obj-$(CONFIG_NET_SIFLOWER_ETH_XGMAC) += sfxgmac.o obj-$(CONFIG_NET_SIFLOWER_ETH_DMA) += sfxgmac-dma.o -obj-$(CONFIG_NET_SIFLOWER_ETH_XPCS) += sfxpcs.o \ No newline at end of file +obj-$(CONFIG_NET_SIFLOWER_ETH_XPCS) += sfxpcs.o diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/dpns.h b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/dpns.h index 1db8139b08..59d97b8955 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/dpns.h +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/dpns.h @@ -56,4 +56,4 @@ int dpns_se_init(struct dpns_priv *priv); int dpns_tmu_init(struct dpns_priv *priv); void sf_dpns_debugfs_init(struct dpns_priv *priv); -#endif /* __SF_DPNS_H__ */ \ No newline at end of file +#endif /* __SF_DPNS_H__ */ diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/eth.h b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/eth.h index 0a813d9489..a065c46eba 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/eth.h +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/eth.h @@ -779,4 +779,4 @@ enum { }; #define XGMAC_RDES3_IOC BIT(30) -#endif \ No newline at end of file +#endif diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns.c b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns.c index 4e00b5b7dd..1cd5262c0a 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns.c +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns.c @@ -1,13 +1,18 @@ -#include "linux/delay.h" -#include "linux/reset.h" #include #include +#include +#include +#include +#include #include #include #include +#include +#include #include -#include -#include +#include +#include + #include "dpns.h" diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns_se.c b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns_se.c index 2b5e13e56b..df81197212 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns_se.c +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns_se.c @@ -47,4 +47,4 @@ int dpns_se_init(struct dpns_priv *priv) { ret = dpns_populate_table(priv); return ret; -} \ No newline at end of file +} diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns_se.h b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns_se.h index 2e29092f20..56afe7104e 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns_se.h +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sf_dpns_se.h @@ -74,4 +74,4 @@ #define SE_TCAM_CLR_ACL_SPL BIT(5) #define SE_TCAM_CLR_BLK(x) BIT(x) -#endif \ No newline at end of file +#endif diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac-dma.c b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac-dma.c index 3061b89e42..2575ea180f 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac-dma.c +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac-dma.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -737,7 +738,7 @@ static int xgmac_dma_alloc_rx_descs(struct xgmac_dma_priv *priv) int ret = -ENOMEM; u32 i; - pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV | PP_FLAG_PAGE_FRAG; + pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV; pp_params.pool_size = DMA_RX_SIZE; pp_params.order = 0; pp_params.max_len = PAGE_SIZE; @@ -1116,7 +1117,7 @@ drop: } -netdev_tx_t xgmac_dma_xmit(struct sk_buff *skb, struct xgmac_dma_priv *priv) +static netdev_tx_t xgmac_dma_xmit(struct sk_buff *skb, struct xgmac_dma_priv *priv) { u16 queue = skb_get_queue_mapping(skb); u16 channel = queue; @@ -1615,4 +1616,4 @@ module_platform_driver(xgmac_dma_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Qingfang Deng "); -MODULE_DESCRIPTION("Ethernet DMA driver for SF21A6826/SF21H8898 SoC"); \ No newline at end of file +MODULE_DESCRIPTION("Ethernet DMA driver for SF21A6826/SF21H8898 SoC"); diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac-ext.h b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac-ext.h index 4524daddfd..59efff0118 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac-ext.h +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac-ext.h @@ -1,4 +1,4 @@ -#ifndef __XGMAC_EXT_H_ +#ifndef __XGMAC_EXT_H__ #define __XGMAC_EXT_H__ #include @@ -28,4 +28,4 @@ struct gmac_common { GMAC_COMMON_STRUCT; }; -#endif \ No newline at end of file +#endif diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac.c b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac.c index 5eec4ff667..bd111ae5bb 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac.c +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxgmac.c @@ -9,6 +9,9 @@ #include #include #include +#include +#include +#include #include "dma.h" #include "eth.h" @@ -676,31 +679,6 @@ static const struct net_device_ops xgmac_netdev_ops = { .ndo_change_mtu = xgmac_change_mtu, }; -static void xgmac_validate(struct phylink_config *config, - unsigned long *supported, - struct phylink_link_state *state) -{ - __ETHTOOL_DECLARE_LINK_MODE_MASK(mac_supported) = {}; - - phylink_set(mac_supported, 10baseT_Half); - phylink_set(mac_supported, 10baseT_Full); - phylink_set(mac_supported, 100baseT_Half); - phylink_set(mac_supported, 100baseT_Full); - phylink_set(mac_supported, 1000baseT_Full); - phylink_set(mac_supported, 1000baseX_Full); - phylink_set(mac_supported, 1000baseKX_Full); - phylink_set(mac_supported, 2500baseT_Full); - phylink_set(mac_supported, 2500baseX_Full); - - phylink_set(mac_supported, Autoneg); - phylink_set(mac_supported, Pause); - phylink_set(mac_supported, Asym_Pause); - phylink_set_port_modes(mac_supported); - - linkmode_and(supported, supported, mac_supported); - linkmode_and(state->advertising, state->advertising, mac_supported); -} - static struct xgmac_priv *sfxgmac_phylink_to_port(struct phylink_config *config) { return container_of(config, struct xgmac_priv, phylink_config); @@ -875,7 +853,6 @@ static void xgmac_mac_link_up(struct phylink_config *config, } static const struct phylink_mac_ops xgmac_phylink_mac_ops = { - .validate = xgmac_validate, .mac_select_pcs = xgmac_mac_selct_pcs, .mac_config = xgmac_mac_config, .mac_link_down = xgmac_mac_link_down, @@ -980,37 +957,37 @@ static int xgmac_ethtool_get_link_ksettings(struct net_device *dev, return phylink_ethtool_ksettings_get(priv->phylink, cmd); } -static int xgmac_ethtool_get_eee(struct net_device *dev, struct ethtool_eee *e) +static int xgmac_ethtool_get_eee(struct net_device *dev, struct ethtool_keee *eee) { struct xgmac_priv *priv = netdev_priv(dev); int ret; - ret = phylink_ethtool_get_eee(priv->phylink, e); + ret = phylink_ethtool_get_eee(priv->phylink, eee); if (ret) return ret; - e->tx_lpi_enabled = priv->tx_lpi_enabled; - e->tx_lpi_timer = reg_read(priv, XGMAC_LPI_AUTO_EN); + eee->tx_lpi_enabled = priv->tx_lpi_enabled; + eee->tx_lpi_timer = reg_read(priv, XGMAC_LPI_AUTO_EN); return 0; } -static int xgmac_ethtool_set_eee(struct net_device *dev, struct ethtool_eee *e) +static int xgmac_ethtool_set_eee(struct net_device *dev, struct ethtool_keee *eee) { struct xgmac_priv *priv = netdev_priv(dev); int ret; - if (e->tx_lpi_timer > XGMAC_LPI_AUTO_EN_MAX) + if (eee->tx_lpi_timer > XGMAC_LPI_AUTO_EN_MAX) return -EINVAL; - ret = phylink_ethtool_set_eee(priv->phylink, e); + ret = phylink_ethtool_set_eee(priv->phylink, eee); if (ret) return ret; - priv->tx_lpi_enabled = e->tx_lpi_enabled; + priv->tx_lpi_enabled = eee->tx_lpi_enabled; xgmac_toggle_tx_lpi(priv); - reg_write(priv, XGMAC_LPI_AUTO_EN, e->tx_lpi_timer); + reg_write(priv, XGMAC_LPI_AUTO_EN, eee->tx_lpi_timer); return 0; } @@ -1221,7 +1198,7 @@ static int xgmac_probe(struct platform_device *pdev) ndev->netdev_ops = &xgmac_netdev_ops; ndev->ethtool_ops = &xgmac_ethtool_ops; ndev->features = NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_GRO | - NETIF_F_SG | NETIF_F_LLTX | NETIF_F_HW_TC | + NETIF_F_SG | NETIF_F_HW_TC | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6; ndev->hw_features = (ndev->features & ~NETIF_F_RXHASH) | @@ -1321,4 +1298,4 @@ module_platform_driver(xgmac_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Qingfang Deng "); -MODULE_DESCRIPTION("Ethernet XGMAC driver for SF21A6826/SF21H8898 SoC"); \ No newline at end of file +MODULE_DESCRIPTION("Ethernet XGMAC driver for SF21A6826/SF21H8898 SoC"); diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxpcs.c b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxpcs.c index 9c75076cdc..ae20940f5a 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxpcs.c +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/siflower/sfxpcs.c @@ -1,5 +1,9 @@ #define pr_fmt(fmt) "xpcs: " fmt +#include +#include +#include +#include #include #include #include diff --git a/target/linux/siflower/files-6.12/drivers/net/ethernet/stmicro/stmmac/dwmac-sf19a2890.c b/target/linux/siflower/files-6.12/drivers/net/ethernet/stmicro/stmmac/dwmac-sf19a2890.c index 05067e9a43..5a0024f827 100644 --- a/target/linux/siflower/files-6.12/drivers/net/ethernet/stmicro/stmmac/dwmac-sf19a2890.c +++ b/target/linux/siflower/files-6.12/drivers/net/ethernet/stmicro/stmmac/dwmac-sf19a2890.c @@ -145,7 +145,7 @@ static int sf19a2890_gmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); if (IS_ERR(plat_dat)) { dev_err(&pdev->dev, "dt configuration failed\n"); return PTR_ERR(plat_dat); @@ -160,14 +160,6 @@ static int sf19a2890_gmac_probe(struct platform_device *pdev) plat_dat->flags |= STMMAC_FLAG_HAS_INTEGRATED_PCS; ret = stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res); - if (ret) - goto err_remove_config_dt; - - return 0; - -err_remove_config_dt: - if (pdev->dev.of_node) - stmmac_remove_config_dt(pdev, plat_dat); return ret; } diff --git a/target/linux/siflower/files-6.12/drivers/net/phy/siflower.c b/target/linux/siflower/files-6.12/drivers/net/phy/siflower.c index b23335408f..22acb5b67e 100644 --- a/target/linux/siflower/files-6.12/drivers/net/phy/siflower.c +++ b/target/linux/siflower/files-6.12/drivers/net/phy/siflower.c @@ -410,7 +410,7 @@ static int sfphy_restart_aneg(struct phy_device *phydev) return 0; } -int sf1211f_config_aneg(struct phy_device *phydev) +static int sf1211f_config_aneg(struct phy_device *phydev) { int ret, phymode, oldpage = 0; @@ -450,7 +450,7 @@ int sf1211f_config_aneg(struct phy_device *phydev) return 0; } -int sf1211f_aneg_done(struct phy_device *phydev) +static int sf1211f_aneg_done(struct phy_device *phydev) { int val = 0; @@ -757,7 +757,7 @@ static int phy_mode_set(struct phy_device *phydev, u16 phyMode) } #endif -int sf1240_config_init(struct phy_device *phydev) +static int sf1240_config_init(struct phy_device *phydev) { int ret; ret = genphy_read_abilities(phydev); @@ -771,7 +771,7 @@ int sf1240_config_init(struct phy_device *phydev) return 0; } -int sf1211f_config_init(struct phy_device *phydev) +static int sf1211f_config_init(struct phy_device *phydev) { int ret, phymode; diff --git a/target/linux/siflower/files-6.12/drivers/pci/controller/dwc/pcie-sf21.c b/target/linux/siflower/files-6.12/drivers/pci/controller/dwc/pcie-sf21.c index ce9c05710d..a32695260f 100644 --- a/target/linux/siflower/files-6.12/drivers/pci/controller/dwc/pcie-sf21.c +++ b/target/linux/siflower/files-6.12/drivers/pci/controller/dwc/pcie-sf21.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -221,7 +220,7 @@ static int sf_pcie_host_init(struct dw_pcie_rp *pp) return 0; } -void sf_pcie_host_deinit(struct dw_pcie_rp *pp) { +static void sf_pcie_host_deinit(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct sf_pcie *sf_pcie = to_sf_pcie(pci); @@ -235,8 +234,8 @@ void sf_pcie_host_deinit(struct dw_pcie_rp *pp) { } static const struct dw_pcie_host_ops sf_pcie_host_ops = { - .host_init = sf_pcie_host_init, - .host_deinit = sf_pcie_host_deinit, + .init = sf_pcie_host_init, + .deinit = sf_pcie_host_deinit, }; static int sf_pcie_start_link(struct dw_pcie *pci) diff --git a/target/linux/siflower/files-6.12/drivers/phy/siflower/Kconfig b/target/linux/siflower/files-6.12/drivers/phy/siflower/Kconfig index 5124c81f79..6b815a3c47 100644 --- a/target/linux/siflower/files-6.12/drivers/phy/siflower/Kconfig +++ b/target/linux/siflower/files-6.12/drivers/phy/siflower/Kconfig @@ -13,7 +13,6 @@ config PHY_SF21_PCIE help Enable this to support the PCIE PHY on the Siflower SF21A6826 SoC. - config PHY_SF21_USB tristate "Siflower SF21A6826/SF21H8898 USB2.0 PHY driver" default n -- 2.30.2